package com.bdsy.business.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.business.dao.ZlOrderMapper;
import com.bdsy.business.model.Order;
import com.bdsy.business.model.ZlOrder;
import com.bdsy.business.service.ZlOrderService;
import com.bdsy.common.utils.DateUtil;

@Service("zlOrderService")
public class ZlOrderServiceImpl implements ZlOrderService{

	@Autowired
	ZlOrderMapper zlOrderMapper;
	
	@Override
	public List<Map> selectZlOrderById(String userId) {
		List<Map> zlOrderList = zlOrderMapper.selectZlOrderById(userId);
		return zlOrderList;
	}

	@Override
	public List<Map> zlOrderListById(String userId, int zlStatus,int status) {
		List<Map> zlOrderList = zlOrderMapper.zlOrderListById(userId, zlStatus,status);
		return zlOrderList;
	}

	@Override
	public List<String> selectZlOrderId(String userId, int zlStatus) {
		List<String> zlOrderIdList = zlOrderMapper.selectZlOrderId(userId, zlStatus);
		return zlOrderIdList;
	}

	@Override
	public List<Map> selectZlOrderByOrderId(String orderId,int status) {
		List<Map> zlOrderList = zlOrderMapper.selectZlOrderByOrderId(orderId,status);
		return zlOrderList;
	}

	@Override
	public boolean insert(ZlOrder zlOrder) {
		zlOrder.setZlStartTime(DateUtil.getCurrentDate());
		//订单状态(0 1)
		if(zlOrder.getZlStatus() == null){
			zlOrder.setZlStatus(0);
		}
		int result = zlOrderMapper.insert(zlOrder);
		return result>0?true:false;
	}

	@Override
	public boolean updateZlOrderStatus(ZlOrder zlOrder) {
		int result = zlOrderMapper.updateZlOrderStatus(zlOrder);
		return result>0?true:false;
	}

	@Override
	public boolean deleteZlOrderById(List<String> pIds) {
		int result = zlOrderMapper.deleteZlOrderById(pIds);
		return result>0?true:false;
	}

	@Override
	public List<Map> zlOrderListByIdStatus(String userId, int status) {
		List<Map> zlOrderList =  zlOrderMapper.zlOrderListByIdStatus(userId, status);
		return zlOrderList;
	}

	@Override
	public int azlCount(String userId) {
		int azlCount = zlOrderMapper.azlCount(userId);
		return azlCount;
	}

	@Override
	public int nzlCount(String userId) {
		int nzlCount = zlOrderMapper.nzlCount(userId);
		return nzlCount;
	}

	@Override
	public List<Map> selectNZlOrderById(String userId) {
		List<Map> nZlOrderList = zlOrderMapper.selectNZlOrderById(userId);
		return nZlOrderList;
	}

	@Override
	public List<Map> zsaleStatis(String userId) {
		List<Map> zsaleStatis = zlOrderMapper.zsaleStatis(userId);
		return zsaleStatis;
	}

	@Override
	public List<Map> areadyZlOrderList(String userId, int shopTypeId, int lx, int qx) {
		List<Map> areadyZlOrderList = zlOrderMapper.areadyZlOrderList(userId, shopTypeId, lx, qx);
		return areadyZlOrderList;
	}
	
	@Override
	public List<Map> nareadyZlOrderList(String userId, int shopTypeId,int zlStatus,int status, int qx) {
		List<Map> nareadyZlOrderList = zlOrderMapper.nareadyZlOrderList(userId, shopTypeId,zlStatus,status, qx);
		return nareadyZlOrderList;
	}

	@Override
	public List<Map> zorderListByUserIdStatus(String userId, int shopTypeId, int zlStatus, int status) {
		List<Map> zlOrderList = zlOrderMapper.zorderListByUserIdStatus(userId, shopTypeId, zlStatus, status);
		return zlOrderList;
	}
}
